home *** CD-ROM | disk | FTP | other *** search
/ MacFormat España 4 / MacFormat n. 4 (Spain) / MacFormat 4.bin / La ciudad del ShareWare / Desarrollo / OutOfPhase1.1 Source / OutOfPhase Folder / MainWindowStuff.h < prev    next >
Encoding:
C/C++ Source or Header  |  1995-01-05  |  14.8 KB  |  375 lines

  1. /* MainWindowStuff.h */
  2.  
  3. #ifndef Included_MainWindowStuff_h
  4. #define Included_MainWindowStuff_h
  5.  
  6. /* MainWindowStuff module depends on */
  7. /* MiscInfo.h */
  8. /* Audit */
  9. /* Debug */
  10. /* Definitions */
  11. /* Memory */
  12. /* Screen */
  13. /* EventLoop */
  14. /* Menus */
  15. /* Files */
  16. /* WindowDispatcher */
  17. /* Array */
  18. /* CodeCenter */
  19. /* TextEdit */
  20. /* SampleList */
  21. /* FunctionList */
  22. /* AlgoSampList */
  23. /* WaveTableList */
  24. /* AlgoWaveTableList */
  25. /* InstrList */
  26. /* TrackList */
  27. /* Alert */
  28. /* StartupOpen */
  29. /* CalculatorWindow */
  30. /* GrowIcon */
  31. /* Main */
  32. /* DisassemblyWindow */
  33. /* PcodeSystem */
  34. /* DataMunging */
  35. /* FixedPoint */
  36. /* SampleConsts */
  37. /* NumberDialog */
  38. /* Numbers */
  39. /* GlobalWindowMenuList */
  40. /* BinaryCodedDecimal */
  41. /* PlayPrefsDialog */
  42. /* ImportWAVSample */
  43. /* ImportRAWSample */
  44. /* ImportAIFFSample */
  45. /* BufferedFileInput */
  46. /* BufferedFileOutput */
  47. /* InteractionWindow */
  48. /* ScoreEffectWindow */
  49. /* EffectSpecList */
  50. /* BuildInstrument */
  51.  
  52. #include "Screen.h"
  53. #include "EventLoop.h"
  54. #include "Menus.h"
  55. #include "FixedPoint.h"
  56. #include "SampleConsts.h"
  57.  
  58. struct MainWindowRec;
  59. typedef struct MainWindowRec MainWindowRec;
  60.  
  61. /* forward declarations */
  62. struct FileSpec;
  63. struct FileType;
  64. struct CalcWindowRec;
  65. struct DisaWindowRec;
  66. struct WaveTableObjectRec;
  67. struct SampleObjectRec;
  68. struct BufferedInputRec;
  69. struct BufferedOutputRec;
  70. struct SampleListRec;
  71. struct AlgoSampListRec;
  72. struct WaveTableListRec;
  73. struct AlgoWaveTableListRec;
  74. struct InstrListRec;
  75. struct InteractionWindowRec;
  76. struct EffectSpecListRec;
  77. struct ScoreEffectWindowRec;
  78.  
  79. /* this enum is used for remembering what kind of final output we want */
  80. typedef enum
  81.     {
  82.         eOutput8Bits EXECUTE(= -5135),
  83.         eOutput16Bits,
  84.         eOutput24Bits,
  85.         eOutput32Bits
  86.     } OutputNumBitsType;
  87.  
  88. /* errors that can occur when attempting to load or save a file */
  89. typedef enum
  90.     {
  91.         eFileLoadNoError EXECUTE(= -31251),
  92.         eFileLoadBadFormat,
  93.         eFileLoadDiskError,
  94.         eFileLoadOutOfMemory
  95.     } FileLoadingErrors;
  96.  
  97.  
  98. /* initialize internal data structures for documents */
  99. MyBoolean                        InitializeDocuments(void);
  100.  
  101. /* clean up any internal data structures used for documents */
  102. void                                ShutdownDocuments(void);
  103.  
  104.  
  105. /* open a new document window and load the document in.  the function takes */
  106. /* ownership of the file specification. */
  107. void                                OpenDocument(struct FileSpec* TheFile);
  108.  
  109. /* close all open documents, subject to the user's ok */
  110. void                                DoCloseAllQuitPending(void);
  111.  
  112. /* close a document.  If the user cancelled, then return False, otherwise True */
  113. MyBoolean                        CloseDocument(MainWindowRec* Window);
  114.  
  115. /* save the document into the current file.  if it hasn't been saved, then call SaveAs */
  116. /* it returns False if it fails. */
  117. MyBoolean                        SaveDocument(MainWindowRec* Window);
  118.  
  119. /* save the document into a new file (don't disturb the current one).  returns False */
  120. /* if it fails.  this function calls SaveDocument() to do the work. */
  121. MyBoolean                        SaveDocumentAs(MainWindowRec* Window);
  122.  
  123.  
  124. /* return True if the document has been modified & should be saved. */
  125. MyBoolean                        HasDocumentBeenModified(MainWindowRec* Window);
  126.  
  127.  
  128. /* main window event handling functions */
  129. void                                MainWindowDoIdle(MainWindowRec* Window,
  130.                                             MyBoolean CheckCursorFlag, OrdType XLoc, OrdType YLoc,
  131.                                             ModifierFlags Modifiers);
  132. void                                MainWindowBecomeActive(MainWindowRec* Window);
  133. void                                MainWindowBecomeInactive(MainWindowRec* Window);
  134. void                                MainWindowJustResized(MainWindowRec* Window);
  135. void                                MainWindowDoMouseDown(OrdType XLoc, OrdType YLoc,
  136.                                             ModifierFlags Modifiers, MainWindowRec* Window);
  137. void                                MainWindowDoKeyDown(unsigned char KeyCode, ModifierFlags Modifiers,
  138.                                             MainWindowRec* Window);
  139. void                                MainWindowClose(MainWindowRec* Window);
  140. void                                MainWindowUpdator(MainWindowRec* Window);
  141. void                                MainWindowMenuSetup(MainWindowRec* Window);
  142. void                                MainWindowDoMenuCommand(MainWindowRec* Window,
  143.                                             MenuItemType* MenuItem);
  144.  
  145.  
  146. /* get the number of spaces per tab that editors should use */
  147. long                                MainWindowGetTabSize(MainWindowRec* Window);
  148.  
  149.  
  150. /* build any function objects that need to be built.  returns True if all of them */
  151. /* were built without a problem. */
  152. MyBoolean                        MainWindowMakeUpToDateFunctions(MainWindowRec* Window);
  153.  
  154. /* build any algorithmic samples that need to be built.  returns True if all of them */
  155. /* were built without a problem. */
  156. MyBoolean                        MainWindowMakeUpToDateAlgoSamps(MainWindowRec* Window);
  157.  
  158. /* build any algorithmic wave tables that need to be built.  returns True if all of */
  159. /* them were built without a problem. */
  160. MyBoolean                        MainWindowMakeUpToDateAlgoWaveTables(MainWindowRec* Window);
  161.  
  162. /* build any instrument specifications that need to be built.  returns True if all of */
  163. /* them were built without a problem. */
  164. MyBoolean                        MainWindowMakeUpToDateInstrList(MainWindowRec* Window);
  165.  
  166.  
  167. /* build everything.  returns True if everything built correctly */
  168. MyBoolean                        MainWindowMakeEverythingUpToDate(MainWindowRec* Window);
  169.  
  170.  
  171. /* deselect any selection in a scrolling list other than the specified list. */
  172. /* specified list may be NIL for unconditional deselect */
  173. void                                MainWindowDeselectAllOtherStringLists(MainWindowRec* Window,
  174.                                             void* TheDontDeselectStringList);
  175.  
  176.  
  177. /* create a new calculator window.  the main window keeps track of all calculator */
  178. /* objects that it has created */
  179. void                                MainWindowNewCalculator(MainWindowRec* Window);
  180.  
  181. /* when a calculator window closes, it calls this to make sure the main window */
  182. /* object knows that it no longer exists */
  183. void                                MainWindowCalculatorClosingNotify(MainWindowRec* Window,
  184.                                             struct CalcWindowRec* Calc);
  185.  
  186.  
  187. /* create an interaction window or return the current interaction window if one */
  188. /* already exists. */
  189. struct InteractionWindowRec*    MainWindowGetInteractionWindow(MainWindowRec* Window);
  190.  
  191. /* notify the main window that the interaction window has closed. */
  192. void                                MainWindowInteractionClosingNotify(MainWindowRec* Window,
  193.                                             struct InteractionWindowRec* Interaction);
  194.  
  195.  
  196. /* notify the main window that a new disassembly window has been created. */
  197. MyBoolean                        MainWindowNewDisassemblyNotify(MainWindowRec* Window,
  198.                                             struct DisaWindowRec* DisassemblyWindow);
  199.  
  200. /* notify the main window that a disassembly window has been destroyed. */
  201. void                                MainWindowDisassemblyClosingNotify(MainWindowRec* Window,
  202.                                             struct DisaWindowRec* DisassemblyWindow);
  203.  
  204.  
  205. /* enable global menu items.  these are menu items that can be chosen regardless */
  206. /* of which editor is open (such as New Object, Save...) */
  207. void                                MainWindowEnableGlobalMenus(MainWindowRec* Window);
  208.  
  209. /* this checks to see if the menu item is a global menu item.  if it is, the */
  210. /* associated action is performed and it returns True.  if not, then it returns */
  211. /* False and the specific editor window must handle the menu item. */
  212. MyBoolean                        MainWindowDoGlobalMenuItem(MainWindowRec* Window,
  213.                                             MenuItemType* MenuItem);
  214.  
  215.  
  216. /* get a copy of the left-channel array from a stereo sample.  an error is returned */
  217. /* indicating the success or failure of this call.  the caller is responsible for */
  218. /* disposing both the returned array (*DataOut) and the name string */
  219. SampleErrors                MainWindowGetSampleLeftCopy(MainWindowRec* Window,
  220.                                             char* NullTerminatedName, largefixedsigned** DataOut);
  221.  
  222. /* get a copy of the right-channel array from a stereo sample.  an error is returned */
  223. /* indicating the success or failure of this call.  the caller is responsible for */
  224. /* disposing both the returned array (*DataOut) and the name string */
  225. SampleErrors                MainWindowGetSampleRightCopy(MainWindowRec* Window,
  226.                                             char* NullTerminatedName, largefixedsigned** DataOut);
  227.  
  228. /* get a copy of the sample array from a mono sample.  an error is returned */
  229. /* indicating the success or failure of this call.  the caller is responsible for */
  230. /* disposing both the returned array (*DataOut) and the name string */
  231. SampleErrors                MainWindowGetSampleMonoCopy(MainWindowRec* Window,
  232.                                             char* NullTerminatedName, largefixedsigned** DataOut);
  233.  
  234. /* get the number of frames per wave period for the specified wave table.  an error */
  235. /* code is returned indicating success or failure.  the caller is responsible for */
  236. /* disposing of the name string. */
  237. SampleErrors                MainWindowGetWaveTableFrameCount(MainWindowRec* Window,
  238.                                             char* NullTerminatedName, long* FrameCountOut);
  239.  
  240. /* get the number of tables in the specified wave table.  an error */
  241. /* code is returned indicating success or failure.  the caller is responsible for */
  242. /* disposing of the name string. */
  243. SampleErrors                MainWindowGetWaveTableTableCount(MainWindowRec* Window,
  244.                                             char* NullTerminatedName, long* TableCountOut);
  245.  
  246. /* get a copy of the sample array from a wave table.  an error is returned */
  247. /* indicating the success or failure of this call.  the caller is responsible for */
  248. /* disposing both the returned array (*DataOut) and the name string */
  249. SampleErrors                MainWindowGetWaveTableArray(MainWindowRec* Window,
  250.                                             char* NullTerminatedName, largefixedsigned** DataOut);
  251.  
  252. /* open a new sample editor initialized with the parameters and install the data */
  253. /* in the array RawData into it.  this array is NOT largefixedsigned, but rather is */
  254. /* signed char or signed short, depending on the setting of NumBits.  the caller */
  255. /* is responsible for disposing of RawData. */
  256. struct SampleObjectRec*    MainWindowCopyRawSampleAndOpen(MainWindowRec* Window,
  257.                                             char* RawData, NumBitsType NumBits, NumChannelsType NumChannels,
  258.                                             long Origin, long LoopStart1, long LoopStart2, long LoopStart3,
  259.                                             long LoopEnd1, long LoopEnd2, long LoopEnd3, long SamplingRate,
  260.                                             double NaturalFrequency);
  261.  
  262. /* open a new wave table editor initialized with the parameters and install the data */
  263. /* in the array RawData into it.  this array is not largefixedsigned, but rather is */
  264. /* signed char or signed short, depending on the setting of NumBits.  the caller */
  265. /* is responsible for disposing of RawData. */
  266. struct WaveTableObjectRec*    MainWindowCopyRawWaveTableAndOpen(MainWindowRec* Window,
  267.                                             char* RawData, NumBitsType NumBits, long NumTables,
  268.                                             long FramesPerTable);
  269.  
  270.  
  271. /* get a copy of the name of the current document file.  the name is a heap-allocated */
  272. /* non-null-terminated block. */
  273. char*                                GetCopyOfDocumentName(MainWindowRec* Window);
  274.  
  275. /* dispatch a name change event.  this tells all editors that the document title */
  276. /* has changed, and the window titles should be updated accordingly. */
  277. void                                MainWindowDispatchNameChange(MainWindowRec* Window);
  278.  
  279.  
  280. /* get various attributes for playing back the song */
  281. MyBoolean                        MainWindowGetStereo(MainWindowRec* Window);
  282. MyBoolean                        MainWindowGetSurround(MainWindowRec* Window);
  283. long                                MainWindowGetSamplingRate(MainWindowRec* Window);
  284. long                                MainWindowGetEnvelopeRate(MainWindowRec* Window);
  285. double                            MainWindowGetBeatsPerMinute(MainWindowRec* Window);
  286. double                            MainWindowGetVolumeScaling(MainWindowRec* Window);
  287. OutputNumBitsType        MainWindowGetOutputNumBits(MainWindowRec* Window);
  288. MyBoolean                        MainWindowGetInterpolationOverTime(MainWindowRec* Window);
  289. MyBoolean                        MainWindowGetInterpolationAcrossWaves(MainWindowRec* Window);
  290. double                            MainWindowGetScanningGap(MainWindowRec* Window);
  291. double                            MainWindowGetBufferDuration(MainWindowRec* Window);
  292. MyBoolean                        MainWindowGetClipWarning(MainWindowRec* Window);
  293. char*                                MainWindowGetScoreEffects(MainWindowRec* Window);
  294.  
  295.  
  296. /* store new values for song playback attributes */
  297. void                                PutMainWindowStereo(MainWindowRec* Window, MyBoolean NewStereoFlag);
  298. void                                PutMainWindowSurround(MainWindowRec* Window, MyBoolean NewSurround);
  299. void                                PutMainWindowSamplingRate(MainWindowRec* Window,
  300.                                             long NewSamplingRate);
  301. void                                PutMainWindowEnvelopeRate(MainWindowRec* Window,
  302.                                             long NewEnvelopeRate);
  303. void                                PutMainWindowBeatsPerMinute(MainWindowRec* Window,
  304.                                             double NewBeatsPerMinute);
  305. void                                PutMainWindowVolumeScaling(MainWindowRec* Window,
  306.                                             double NewVolumeScaling);
  307. void                                PutMainWindowOutputNumBits(MainWindowRec* Window,
  308.                                             OutputNumBitsType NewOutputNumBits);
  309. void                                PutMainWindowInterpolationOverTime(MainWindowRec* Window,
  310.                                             MyBoolean NewInterpOverTime);
  311. void                                PutMainWindowInterpolationAcrossWaves(MainWindowRec* Window,
  312.                                             MyBoolean NewInterpAcrossWaves);
  313. void                                PutMainWindowScanningGap(MainWindowRec* Window,
  314.                                             double NewScanningGap);
  315. void                                PutMainWindowBufferDuration(MainWindowRec* Window,
  316.                                             double NewBufferDuration);
  317. void                                PutMainWindowClipWarning(MainWindowRec* Window,
  318.                                             MyBoolean NewClipWarning);
  319. void                                PutMainWindowScoreEffects(MainWindowRec* Window,
  320.                                             char* NewScoreEffects);
  321.  
  322.  
  323. /* read the general information subblock from the specified file. */
  324. FileLoadingErrors        MainWindowReadData(MainWindowRec* Window,
  325.                                             struct BufferedInputRec* Input, short* FormatVersionNumber);
  326.  
  327. /* write the general information subblock to the specified file. */
  328. FileLoadingErrors        MainWindowWriteData(MainWindowRec* Window,
  329.                                             struct BufferedOutputRec* Output);
  330.  
  331.  
  332. /* get the sample list object for the specified document.  the actual thing */
  333. /* is returned */
  334. struct SampleListRec*    MainWindowGetSampleList(MainWindowRec* Window);
  335.  
  336. /* get the algorithmic sample list object for the specified document.  the actual */
  337. /* thing is returned. */
  338. struct AlgoSampListRec*    MainWindowGetAlgoSampList(MainWindowRec* Window);
  339.  
  340. /* get the wave table list object for the specified document.  the actual thing */
  341. /* is returned */
  342. struct WaveTableListRec*    MainWindowGetWaveTableList(MainWindowRec* Window);
  343.  
  344. /* get the algorithmic wave table list object for the specified document.  the */
  345. /* actual thing is returned */
  346. struct AlgoWaveTableListRec*    MainWindowGetAlgoWaveTableList(MainWindowRec* Window);
  347.  
  348. /* get the instrument list object for the specified document.  the actual thing */
  349. /* is returned */
  350. struct InstrListRec*    MainWindowGetInstrList(MainWindowRec* Window);
  351.  
  352.  
  353. /* clear instrument object code.  instruments contain references to other objects, */
  354. /* so this function must be called any time other objects are deleted, to unbuild */
  355. /* instruments and avoid dangling pointers. */
  356. void                                MainWindowClearInstrObjects(MainWindowRec* Window);
  357.  
  358.  
  359. /* this updates the object deletion undo information */
  360. void                                MainWindowNewDeleteUndoInfo(MainWindowRec* Window,
  361.                                             struct FileSpec* Location, struct FileType* File);
  362.  
  363.  
  364. /* show the score effect window */
  365. MyBoolean                        MainWindowOpenScoreEffectWindow(MainWindowRec* Window);
  366.  
  367. /* mark score effect window as closed */
  368. void                                MainWindowNotifyScoreEffectWindowClosed(MainWindowRec* Window,
  369.                                             struct ScoreEffectWindowRec* TheOne);
  370.  
  371. /* obtain the score effects specification */
  372. struct EffectSpecListRec*    MainWindowGetScoreEffectsSpec(MainWindowRec* Window);
  373.  
  374. #endif
  375.